/* 

Main.do

Runs all code for "Human Capital and Climate Change", 
	by Noam Angrist, Kevin Winseck, Harry Patrinos, and Joshua Graff Zivin.

*/


* Absolute paths to folders to contain code, data, and output

cd "/home/kevin/Dropbox/UCSD/WorldBankEducationClimate/ReStatFinalSubmission/CodePackage"


* Parse the spreadsheet of compulsory schooling laws
do "1_ParseCSLs.do"

* Merge ESS data together and with CSL data, and construct necessary variables
do "2_ConstructData.do"

* Make table of first stages and indicators for which reforms should be kept in
*	which specifications (positive significant reforms, positive, or all)
do "3_FirstStage.do"

* Perform second stage analysis, main outcomes of the paper, includes robust estimator
do "4_SecondStage.do"

********************************************************************************
* At this point you can run AggregateCountryEstimates_Correlations.R which will
*	take in the output from 4_SecondStage.do manually entered into the code
********************************************************************************

* Make second stage figures (coefficient plots)
do "5_SecondStageFigures.do"

* Make figures testing robustness and sensitivity
do "6_RobustnessLeaveOneOut.do"

********************************************************************************
* At this point run 7_LeaveOneOutFigures.R in R.
*	While not a dependency for future Stata steps, this is the chronological
*	place to run this.
********************************************************************************

* Make correlations table for appendix
do "8_Correlations.do"

* Make validity and balance test tables
do "9_ValidityBalanceTest.do"

